<script setup>
import router from '@/router';
import LayoutFooter from '../Layout/components/LayoutFooter.vue';
import LayoutNav from '../Layout/components/LayoutNav.vue';
const regionDict = ['北京', '上海', '广州', '深圳']
const categoryList = [
  { id: 1, name: '男装' },
  { id: 2, name: '女装' },
  { id: 3, name: '童装' },
  { id: 4, name: '运动服' },
  { id: 5, name: '内衣' },
  { id: 6, name: '配饰' },
  { id: 7, name: '鞋类' }
]
import { ref } from 'vue';

const projectList = ref([
    {
    id:1,
    image: 'https://cbu01.alicdn.com/img/ibank/2019/830/974/10449479038_998666923.jpg',
    title: '可持续时尚:环保T恤系列',
    initiator:'张三',
    targetQuantity: 500,
    participants: 200,
    startime: '2023-03-01',
    endtime:'2023-05-10'
  },
    {
    id:2,
    image: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.k4VWpMVQWgzNJ-2aMPDY1QHaHa?pid=ImgDet&w=474&h=474&rs=1',
    title: '舒适亲肤，防晒吸汗T恤',
    initiator:'张三',
    targetQuantity: 300,
    participants: 150,
    duration: 45,
    startime: '2023-03-01',
    endtime:'2023-05-10'
    },
    {
    id:1,
    image: 'https://cbu01.alicdn.com/img/ibank/2019/830/974/10449479038_998666923.jpg',
    title: '可持续时尚:环保T恤系列',
    initiator:'张三',
    targetQuantity: 500,
    participants: 200,
    startime: '2023-03-01',
    endtime:'2023-05-10'
  },
      {
    id:2,
    image: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.k4VWpMVQWgzNJ-2aMPDY1QHaHa?pid=ImgDet&w=474&h=474&rs=1',
    title: '舒适亲肤，防晒吸汗T恤',
    targetQuantity: 300,
    initiator:'张三',
    participants: 150,
    duration: 45,
    startime: '2023-03-01',
    endtime:'2023-05-10'
  }
]);



</script>

<template>
    <LayoutNav></LayoutNav>
    <div class="container">
        <div class="header-box">
        <div class="logo">
        <RouterLink to="/">桃禧</RouterLink>
        </div>
        <p>众筹浏览</p>
        <div class="search-box">
            <el-input 
            placeholder="搜索众筹" 
            size="big" 
            clearable ></el-input>
            <el-button 
            type="primary" 
            size="big"
            @click="searchItems">
            搜索
            <i class="iconfont icon-search"></i>
        </el-button>
        </div>
      </div>

            <div class="category-box">
               <ul>
            <li>全部</li>
            <li v-for="category in categoryList" :key="category.id">{{ category.name }}</li>
            </ul>             
            </div>
            <div class="content-box">
                <ul>
                    <li v-for="item in projectList" :key="item.id">
                      <RouterLink :to="{name: 'crowdFundingDetail', params: {projectid: item.id}}" class="project-item">
                        <div class="item-img">
                          <img :src="item.image" alt="项目图片">
                        </div>
                        <div class="main">
                            <p class="title">{{ item.title }}</p>
                            <p class="target">发起人: {{ item.initiator }}</p>
                            <p class="target">目标数量: {{ item.targetQuantity }}</p>
                            <p class="participants">已参与人数: {{ item.participants }}</p>
                            <p class="time">众筹持续时间: {{ item.startime }} 至{{ item.endtime }}</p>
                        </div>           
                      </RouterLink>
                      <!-- <RouterLink :to="'/crowdFunding/detail/'+item.id"></RouterLink> -->
                    </li>
                </ul>
            </div>
        
    </div>
    <LayoutFooter></LayoutFooter>
</template>

<style scoped lang='scss'>
.header-box{
    background: #fff;
    position: relative;
    height: 120px;
    // border-bottom:1px solid #ccc;
    display: flex;
    p{
      font-size: 24px;
      margin-left: 20px;
      margin-top: 50px;
    }
    .logo {
    width: 80px;

    a {
      display: block;
      height: 100px;
      width: 100%;
      text-indent: -9999px;
      background: url('@/assets/images/logo.png') no-repeat center 18px / contain;
    }
  }
  .search-box{
    position: absolute;
    display: flex;
    justify-content: center;
    top: 50%;
    right: 20px;
    .el-input {
        margin-left: 20px;
    }
    .el-button{
        margin-left: 20px;
    }
  }
}

.category-box{
    margin-top: 20px;
  background: #fff;
  ul{
      margin: 10px 0 0 20px;
      display: flex;
      flex-wrap: wrap;
      border-bottom: 1px solid #e0e0e0;
      padding: 10px;
    li{
      padding: 10px;
      margin-right: 20px;
      font-size: 18px;
    }
    }
    .el-dropdown-link{
      font-size: 18px;
    }
} 

.content-box{
    margin-top:20px;
    .project-item{
        display: flex;
        padding: 10px;
        background: #fff;
        margin-bottom: 20px;
        margin-bottom: 20px;
        transition: all .5s;

      &:hover {
        transform: translate3d(0, -3px, 0);
        box-shadow: 0 3px 8px rgb(0 0 0 / 20%);
      }
        img{
            width: 200px;
            height: 200px;
        }
        .main{
            margin-left: 20px;
            .title{
                font-size: 24px;
                padding: 10px;
            }
            p{
                font-size: 18px;
                padding: 5px 0 5px 10px;
            }
        }
    }
}

</style>